#ifndef SIMPLE_SUPPORT_META_REMOVE_IF_HPP
#define SIMPLE_SUPPORT_META_REMOVE_IF_HPP

#include "list.hpp" // list_constructor
#include "reconstruct.hpp" // reconstruct_t
#include "bind.hpp" // bind

#include <type_traits> // std::conditional_t

namespace simple::support::meta
{

	template <typename ListCons, typename Condition, typename... Elements>
	class conditional_list_constructor
	{
		template <typename... Ts>
		using list = typename ListCons::template function<Ts...>;

		public:
		using type = std::conditional_t<Condition::template bound<Elements...>::value,
			list<>,
			list<Elements...>
		>;
	};

	template <typename List, template <typename...> typename Condition>
	using remove_if_t = reconstruct_t
	<
		List,
		bind<conditional_list_constructor, list_constructor<List>, bind<Condition>>::
			template bound
	>;

} // namespace simple::support::meta

#endif /* end of include guard */
